<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>平移 - 2D转换</title>

    <style type="text/css">
        .wrapper {
            width: 200px;
            height: 200px;
            border: 2px solid purple;
            margin: 150px auto;
            transition: transform 500ms;
        }
        
        .first:hover {
            transform: translate(-50%, 50%);
        }
        
        .second:hover {
            transform: translateX(50%);
        }
        
        .third:hover {
            transform: translateY(50%);
        }
    </style>
</head>

<body>

    <div class="wrapper first"></div>

    <div class="wrapper second"></div>

    <div class="wrapper third"></div>

</body>

</html>